﻿@model BussinessLogic.Exercise.ExerciseMaintain
@{
    ViewBag.Title = "CreateExercise";
}
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
@using (Html.BeginForm())
{
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>Photos</legend>
        <h2>
            Neutral</h2>
        @foreach (var neutral in Model.NeutralPhotos)
        {
            <input type="checkbox" name="NeutralPhotos" id="@neutral" value="@neutral" @(Model.SavedNeutralPhotos != null && Model.SavedNeutralPhotos.Contains(neutral) ? "checked=\"checked\"" : "")/>
            <label for="@neutral">
                <img src= "@Url.Content("~/uploads/neutral/" + neutral)" alt="@neutral" />
            </label>  
        }
        <br />
        <br />
        <h2>
            Negative</h2>
        @foreach (var negative in Model.NegativePhotos)
        {
            <input type="checkbox" name="NegativePhotos" id="@negative" value="@negative" @(Model.SavedNegativePhotos != null && Model.SavedNegativePhotos.Contains(negative) ? "checked=\"checked\"" : "")/>
            <label for="@negative">
                <img src= "@Url.Content("~/uploads/negative/" + negative)" alt="@negative" />
            </label>  
        }
    </fieldset>
    
    
    <fieldset>
        <legend>Parameters</legend>
        <div class="editor-label">
            @Html.LabelFor(model => model.PictureTime)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.PictureTime)
            @Html.ValidationMessageFor(model => model.PictureTime)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.CrossNumberTime)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.CrossNumberTime)
            @Html.ValidationMessageFor(model => model.CrossNumberTime)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.BaselineTrials)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.BaselineTrials)
            @Html.ValidationMessageFor(model => model.BaselineTrials)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.FixationTrials)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.FixationTrials)
            @Html.ValidationMessageFor(model => model.FixationTrials)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.FinalSession)
            @Html.CheckBoxFor(model => model.FinalSession)
            @Html.ValidationMessageFor(model => model.FinalSession)
        </div>
        <br />
        <fieldset>
            <legend>Training trials</legend>
            <ul style="list-style: none">
                @foreach (var trial in Model.Trials)
                {
                    <li>
                        <input type="checkbox" name="CheckedTrials" id="@trial.ID" value="@trial.ID" @(trial.Checked ? "checked=\"checked\"" : "") />
                        <input type="text" name="CheckedTrialsRepeat" value="@trial.Repeat" style="width:20px"/>
                        <label for="@trial.ID">
                            @(trial.Convergent ? "Convergent" : "Inconvergent")
                            - @trial.Letter - @trial.LetterPosition
                        </label>
                        
                    </li>
                }
            </ul>
        </fieldset>
        @if (!Model.IsRunning)
        {
            <p>
                <input type="submit" value="Save" />
            </p>    
        }
    </fieldset>
}
<div>
    @Html.ActionLink("Back to List", "Index")
</div>
